<%-- 
    Document   : ListSentence
    Created on : Jan 21, 2013, 10:05:08 AM
    Author     : HTH2207
--%>

<%@page import="entities.Basics"%>
<%@page import="java.util.List"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <h1>Sentence List</h1>
        <table border="1">
            <tr>
                <th>ID</th>
                <th>English</th>
                <th>Vietnamese</th>
                <th>Audio</th>
                <th>Image</th>
                <th></th>
                <th></th>
            </tr>
            <%
                        List<Basics> list = (List) session.getAttribute("list");
                        if (list != null) {
                            session.setAttribute("list", null);
                            for (int i = 0; i < list.size(); i++) {
                                Basics b = list.get(i);
                                String id = b.getId();
                                String eng = b.getEnglish();
                                String viet = b.getVietNamese();
                                String audio = b.getAudio();
                                String img = b.getImage();
                                out.print("<tr>");
                                out.print("<td>" + id + "</td>");
                                out.print("<td>" + eng + "</td>");
                                out.print("<td>" + viet + "</td>");
                                out.print("<td>" + audio + "</td>");
                                out.print("<td>" + img + "</td>");
                                out.print("<td><a href='./UpdateSentence.jsp?id=" + id + "'> Update </a></td>");
                                out.print("<td><a href='./ServletController?action=Delete&id=" + id + "'> Delete </a></td>");
                                out.print("</tr>");
                            }
                        }
            %>
        </table>
        <a href="NewSentence.jsp">Add New</a>
    </body>
</html>
